import { z } from 'zod';

// creating a schema for strings
const mySchema = z.string();

// parsing
console.log(mySchema.parse('tuna')); // => "tuna"
// mySchema.parse(12); // => throws ZodError

// "safe" parsing (doesn't throw error if validation fails)
console.log(mySchema.safeParse('tuna')); // => { success: true; data: "tuna" }
console.log(mySchema.safeParse(12)); // => { success: false; error: ZodError }
// tuna
// { success: true, data: 'tuna' }
// { success: false, error: [Getter] }
